home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Graphics Programming (2nd Edition)
/
Visual Basic Graphics Programming 2nd Edition.iso
/
OldSrc
/
CH1
/
SRC
/
PAINTPIC.FRM
< prev
next >
Wrap
Text File
|
1995-12-13
|
6KB
|
193 lines
VERSION 4.00
Begin VB.Form PaintPicForm
Caption = "PaintPicture"
ClientHeight = 3960
ClientLeft = 2085
ClientTop = 1485
ClientWidth = 5730
Height = 4650
Left = 2025
LinkTopic = "Form1"
ScaleHeight = 3960
ScaleWidth = 5730
Top = 855
Width = 5850
Begin VB.PictureBox Base
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Left = 120
Picture = "PAINTPIC.frx":0000
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 5
Top = 1920
Width = 1020
End
Begin VB.ListBox OpcodeList
Height = 3765
Left = 1200
TabIndex = 4
Top = 120
Width = 2295
End
Begin VB.PictureBox Destination
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 2040
Index = 2
Left = 3600
ScaleHeight = 132
ScaleMode = 3 'Pixel
ScaleWidth = 132
TabIndex = 3
Top = 1800
Width = 2040
End
Begin VB.PictureBox Destination
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 510
Index = 0
Left = 3600
ScaleHeight = 30
ScaleMode = 3 'Pixel
ScaleWidth = 30
TabIndex = 2
Top = 120
Width = 510
End
Begin VB.PictureBox Destination
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Index = 1
Left = 3600
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 1
Top = 720
Width = 1020
End
Begin VB.PictureBox Source
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Left = 120
Picture = "PAINTPIC.frx":0882
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 0
Top = 360
Width = 1020
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "Destination"
Height = 255
Index = 1
Left = 120
TabIndex = 7
Top = 1680
Width = 975
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "Source"
Height = 255
Index = 0
Left = 120
TabIndex = 6
Top = 120
Width = 975
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
End
Attribute VB_Name = "PaintPicForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
' ***********************************************
' Add an opcode's name and value to the list of
' choices.
' ***********************************************
Sub AddOpcode(name As String, value As Long)
OpcodeList.AddItem name
OpcodeList.ItemData(OpcodeList.NewIndex) = value
End Sub
Private Sub Form_Load()
Dim copy_index As Integer
' Load the opcode choices.
AddOpcode "vbBlackness", vbBlackness
AddOpcode "vbDstInvert", vbDstInvert
AddOpcode "vbMergeCopy", vbMergeCopy
AddOpcode "vbMergePaint", vbMergePaint
AddOpcode "vbNotSrcCopy", vbNotSrcCopy
AddOpcode "vbSrcErase", vbSrcErase
AddOpcode "vbPatCopy", vbPatCopy
AddOpcode "vbPatInvert", vbPatInvert
AddOpcode "vbPatPaint", vbPatPaint
AddOpcode "vbSrcAnd", vbSrcAnd
AddOpcode "vbSrcCopy", vbSrcCopy
copy_index = OpcodeList.NewIndex
AddOpcode "vbSrcErase", vbSrcErase
AddOpcode "vbSrcInvert", vbSrcInvert
AddOpcode "vbSrcPaint", vbSrcPaint
AddOpcode "vbWhiteness", vbWhiteness
' Start with vbSrcCopy.
OpcodeList.ListIndex = copy_index
End Sub
Private Sub mnuFileExit_Click()
Unload Me
End Sub
Private Sub OpcodeList_Click()
Const MAX_DEST = 2
Dim i As Integer
Dim X As Single
Dim Y As Single
Dim wid As Single
Dim hgt As Single
Dim opcode As Long
X = Source.ScaleLeft
Y = Source.ScaleTop
wid = Source.ScaleWidth
hgt = Source.ScaleHeight
opcode = OpcodeList.ItemData(OpcodeList.ListIndex)
For i = 0 To MAX_DEST
With Destination(i)
' Copy Base to the destination.
.PaintPicture Base.Picture, _
.ScaleLeft, .ScaleTop, _
.ScaleWidth, .ScaleHeight, _
X, Y, wid, hgt, vbSrcCopy
' Add Source using the chosen opcode.
.PaintPicture Source.Picture, _
.ScaleLeft, .ScaleTop, _
.ScaleWidth, .ScaleHeight, _
X, Y, wid, hgt, opcode
End With
Next i
End Sub